//表单配置项
const formItemData = {
  'expressId': {
    itemConfig: {
      name: 'expressId'
    },
    elConfig: {
      formType: 'Select',
      placeholder: '快递公司',
      options: []
    }
  },
  'ecstoreId': {
    itemConfig: {
      name: 'ecstoreId'
    },
    elConfig: {
      formType: 'Select',
      placeholder: '网点名称',
      options: []
    }
  },
  'networkName': {
    itemConfig: {
      name: 'networkName'
    },
    elConfig: {
      formType: 'Input',
      placeholder: '快递网点',
    }
  },
}

//处理表单数据
export const getFormItem = (optionsData, type) => {
  const arr = [];
  Object.keys(formItemData).map(v => {
    //部分tab下不展示相关搜素
    if(['5','7'].includes(type) && v == 'expressId') {
      return;
    }
    if(['5','6', '7'].includes(type) && v == 'ecstoreId') {
      return;
    }
    if(['6'].includes(type) && v == 'networkName') {
      return;
    }
    if(optionsData && optionsData[v]) {
      if(v == 'ecstoreId') {
        const arr = optionsData[v].map(v => {
          return {
            label: v.storeName,
            value: v.id
          }
        })
        formItemData[v].elConfig.options = arr;
      } else {
        formItemData[v].elConfig.options = optionsData[v];
      }
    }
    arr.push(formItemData[v]);
  })
  return arr;
}

//tab源数据
export const tabArr = [
  { key: '1', tab: '菜鸟' },
  { key: '4', tab: '京东无界' },
  { key: '2', tab: '拼多多' },
  { key: '3', tab: '京东快递' },
  { key: '5', tab: '顺丰快递' },
  { key: '8', tab: '唯品会' },
  { key: '14', tab: '快手快递' },
  { key: '15', tab: '抖音快递' },
  { key: '28', tab: '极兔快递' },
  { key: '6', tab: `${APP_TITLE}快递` },
  { key: '25', tab: '微信视频号' },
  { key: '26', tab: 'WMS淘宝' },
  { key: '40', tab: '小红书' },
];

export const storeMap = {
  1: 8,
  2: 9,
  3: 1,
  4: 1,
  8: 5,
  14: 12,
  15: 15,
  25: 25,
  26: 26,
  40: 40
};